package callnumber.gtdev5.com.photoVault.utils;

import android.content.Context;
import android.os.Vibrator;

/**
 * Created by cheng
 * PackageName FakeCall
 * 2018/6/14 9:33
 */

public class Vibratorutils {
    private static Vibratorutils instance = null;
    public static synchronized Vibratorutils getInstance() {
        if (instance == null)
            instance = new Vibratorutils();
            return instance;
    }
    private Vibrator vibrator;
    /**
     * 开始震动-连续
     * @param context
     */
    public  void vibratorStart(Context context){
         vibrator = (Vibrator)context.getSystemService(context.VIBRATOR_SERVICE);
        long[] patter = {1000, 2000, 1000, 2000};
        vibrator.vibrate(patter, 0);
    }

    /**
     * 取消震动
     */
    public void vibratorCancel(){
        if (vibrator!=null){
            vibrator.cancel();
        }
     }
}
